"use strict";
cc._RF.push(module, '6e2c37jcOFHup0j//h9Beyt', 'MixController');
// scripts/MixController.js

"use strict";

var e = require;
var t = module;
var n = exports;
Object.defineProperty(n, "__esModule", {
  value: !0
});

var o = e("VideoHint"),
    i = e("MixMgr"),
    a = cc._decorator,
    r = a.ccclass,
    s = a.property,
    c = function (e) {
  __extends(t, e);

  function t() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.mixAni = [];
    t.states = [!1, !1, !1, !1];
    t.leftSprite = null;
    t.rightSprite1 = null;
    t.rightSprite2 = null;
    t.leftFrames = [];
    t.rightFrames = [];
    t.adNodes = [];
    t.changeAdSprites = [];
    return t;
  }

  t.prototype.start = function () {
    this.leftSprite.spriteFrame = this.leftFrames[Math.floor(Math.random() * this.leftFrames.length)];
    var e = [0, 1, 2],
        t = e[Math.floor(Math.random() * e.length)];
    e.splice(t, 1);
    var n = e[Math.floor(Math.random() * e.length)];
    this.rightSprite1.spriteFrame = this.rightFrames[t];
    this.rightSprite2.spriteFrame = this.rightFrames[n];
    if (SDK.Mgr.Inst.curChannel != SDK.Define.Channel.tt) for (var o = 0; o < this.changeAdSprites.length; o++) {
      this.changeAdSprites[o].spriteFrame = i["default"].Instance.adSpriteFrame;
    }
  };

  t.prototype.food1Click = function () {
    if (this.states[0]) SDK.ToastMgr.Inst.showToast("已经加过啦");else {
      this.states[0] = !0;
      this.mixAni[0].play();
      this.scheduleOnce(function () {
        i["default"].Instance.addMixNum();
      }, 2);
    }
  };

  t.prototype.food2Click = function () {
    if (this.states[1]) SDK.ToastMgr.Inst.showToast("已经加过啦");else {
      var e = "MixAttriBtn_1_Ad";
      SDK.Mgr.Inst.event(e + "Click");

      var t = this,
          n = function n(a) {
        if (a == SDK.Define.AdsCode.finish) {
          SDK.Mgr.Inst.event(e + "Success");
          t.states[1] = !0;
          t.mixAni[1].play();
          t.adNodes[0].active = !1;
          t.scheduleOnce(function () {
            i["default"].Instance.addMixNum();
          }, 2);
        } else if (a == SDK.Define.AdsCode.cancel) {
          SDK.Mgr.Inst.event(e + "Cancel");
          o["default"].Instance.openPanel(n);
        } else {
          SDK.ToastMgr.Inst.showToast("暂无广告，请稍后再试");
          SDK.Mgr.Inst.event(e + "NoAd");
        }
      };

      SDK.Mgr.Inst.showVideo(n);
    }
  };

  t.prototype.food3Click = function () {
    if (this.states[2]) SDK.ToastMgr.Inst.showToast("已经加过啦");else {
      var e = "MixAttriBtn_2_Ad";
      SDK.Mgr.Inst.event(e + "Click");

      var t = this,
          n = function n(a) {
        if (a == SDK.Define.AdsCode.finish) {
          SDK.Mgr.Inst.event(e + "Success");
          t.states[2] = !0;
          t.mixAni[2].play();
          t.adNodes[1].active = !1;
          t.scheduleOnce(function () {
            i["default"].Instance.addMixNum();
          }, 2);
        } else if (a == SDK.Define.AdsCode.cancel) {
          SDK.Mgr.Inst.event(e + "Cancel");
          o["default"].Instance.openPanel(n);
        } else {
          SDK.ToastMgr.Inst.showToast("暂无广告，请稍后再试");
          SDK.Mgr.Inst.event(e + "NoAd");
        }
      };

      SDK.Mgr.Inst.showVideo(n);
    }
  };

  t.prototype.food4Click = function () {
    if (this.states[3]) SDK.ToastMgr.Inst.showToast("已经加过啦");else {
      var e = "MixAttriBtn_3_Ad";
      SDK.Mgr.Inst.event(e + "Click");

      var t = this,
          n = function n(a) {
        if (a == SDK.Define.AdsCode.finish) {
          SDK.Mgr.Inst.event(e + "Success");
          t.states[3] = !0;
          t.mixAni[3].play();
          t.adNodes[2].active = !1;
          t.scheduleOnce(function () {
            i["default"].Instance.addMixNum();
          }, 2);
        } else if (a == SDK.Define.AdsCode.cancel) {
          SDK.Mgr.Inst.event(e + "Cancel");
          o["default"].Instance.openPanel(n);
        } else {
          SDK.ToastMgr.Inst.showToast("暂无广告，请稍后再试");
          SDK.Mgr.Inst.event(e + "NoAd");
        }
      };

      SDK.Mgr.Inst.showVideo(n);
    }
  };

  __decorate([s([cc.Animation])], t.prototype, "mixAni", void 0);

  __decorate([s(cc.Sprite)], t.prototype, "leftSprite", void 0);

  __decorate([s(cc.Sprite)], t.prototype, "rightSprite1", void 0);

  __decorate([s(cc.Sprite)], t.prototype, "rightSprite2", void 0);

  __decorate([s([cc.SpriteFrame])], t.prototype, "leftFrames", void 0);

  __decorate([s([cc.SpriteFrame])], t.prototype, "rightFrames", void 0);

  __decorate([s([cc.Node])], t.prototype, "adNodes", void 0);

  __decorate([s([cc.Sprite])], t.prototype, "changeAdSprites", void 0);

  return __decorate([r], t);
}(cc.Component);

n["default"] = c;

cc._RF.pop();